# -*- coding: utf-8 -*-
# 各种自定义treeWidget
# @Time    ： 2021/12/3  0:13
# @Auther  ： 徐良
# File     :  treeWidget1.py

from PySide6.QtWidgets import QTreeWidget

class TreeWidget1(QTreeWidget):
    """
    不带选择框
    """

    def __init__(self, parent=None):
        super(TreeWidget1, self).__init__(parent)

        css = """
                QTreeWidget {
                    background-color: white;
                    border: 1px solid #ccc;
                    selection-background-color: #3498db;
                    selection-color: white;
                    alternate-background-color: #f2f2f2;
                    color: #333; /* 修改字体颜色为深灰色 */
                }

                QHeaderView::section {
                    background-color: #3498db;
                    color: white;
                    font-size: 14px; /* 修改字体大小为 20 像素 */
                    padding: 5px;
                }
                """
        self.setStyleSheet(css)


class TreeWidget2(QTreeWidget):

    def __init__(self, parent=None):
        super(TreeWidget2, self).__init__(parent)
        self.setStyleSheet("QHeaderView::section {background-color: "
                           "qlineargradient(x1:0, y1:0, x2:0, y2:1,"
                           "stop:0 #00007f, stop: 0.5 #00007f,"
                           "stop: 0.6 #00007f, stop:1 #00007f);color: white;}")

